package cn.itcast.travel.dao.impl;

import cn.itcast.travel.domain.RouteImg;
import cn.itcast.travel.util.JDBCUtils;
import org.springframework.jdbc.core.BeanPropertyRowMapper;
import org.springframework.jdbc.core.JdbcTemplate;

import java.util.List;

public class TestTab_Route_ImageDao {
    private JdbcTemplate jdbcTemplate=new JdbcTemplate(JDBCUtils.getDataSource());

    public List<RouteImg> findAll(){
        String sql = "select * from tab_route_img";
        return jdbcTemplate.query(sql,new BeanPropertyRowMapper<RouteImg>(RouteImg.class));
    }

    public void uadateRouteImgByRgid(RouteImg routeImg){
        String sql = "update tab_route_img set bigPic=?,smallPic=? where rgid = ?";
        jdbcTemplate.update(sql,routeImg.getBigPic(),routeImg.getSmallPic(),routeImg.getRgid());
    }

}
